package cn.tramy.pinxian.common.util

class ExecuteContext {
    private val mapValues: MutableMap<String, Any> = mutableMapOf()

    companion object {
        private val contextLocal: ThreadLocal<ExecuteContext> = ThreadLocal.withInitial { ExecuteContext() }
        fun current(): ExecuteContext = contextLocal.get()
    }

    fun putValue(key: String, value: Any) {
        this.mapValues[key] = value
    }

    fun getValue(key: String): Any? = this.mapValues[key]

}